<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="clr-namespace:AnthStat.WPF.Presentation.Properties"
    xmlns:controls="clr-namespace:AnthStat.WPF.Presentation.Controls"
    xmlns:converters="clr-namespace:AnthStat.WPF.Applications.Converters;assembly=AnthStat.WPF.Applications"
    xmlns:viewmodels="clr-namespace:AnthStat.WPF.Applications;assembly=AnthStat.WPF.Applications">

    <viewmodels:SettingsPanelViewModel x:Key="SettingsViewModel" />
    
    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    <converters:ChildSelectedBackgroundConverter x:Key="ChildSelectedBackgroundConverter" />
    <converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
    <converters:DaysToMonthsConverter x:Key="DaysToMonthsConverter" />
    <converters:DaysAgoConverter x:Key="DaysAgoConverter" />
    <converters:RoundButtonSizeConverter x:Key="RoundButtonSizeConverter" />
    <converters:MonthsStringFormatter x:Key="MonthsStringFormatter" />
    <converters:PlusOneConverter x:Key="PlusOneConverter" />
    <converters:CollectionCountStringFormatter x:Key="CollectionCountStringFormatter" />
    <converters:ChartConverter x:Key="ChartConverter" />
    <converters:GrowthReferenceToVisibilityConverter x:Key="GrowthReferenceToVisibilityConverter" />
    <converters:WHOAgeCutoffToVisibilityConverter x:Key="WHOAgeCutoffToVisibilityConverter" />
    <converters:AgeAndReferenceToVisibilityConverter x:Key="AgeAndReferenceToVisibilityConverter" />
    <converters:PoundsToKilogramsConverter x:Key="PoundsToKilogramsConverter" />
    <converters:InchesToCentimetersConverter x:Key="InchesToCentimetersConverter" />
    <converters:MetricSystemToVisibilityConverter x:Key="MetricSystemToVisibilityConverter" />
    <converters:ImperialSystemToVisibilityConverter x:Key="ImperialSystemToVisibilityConverter" />
    <converters:MaleToCheckedConverter x:Key="MaleToCheckedConverter" />
    <converters:FemaleToCheckedConverter x:Key="FemaleToCheckedConverter" />
    <converters:BooleanInverter x:Key="BooleanInverter" />
    <converters:MessageBoxButtonConverter x:Key="MessageBoxButtonConverter" />
    <converters:ZScoreToBackgroundBrushConverter x:Key="ZScoreToBackgroundBrushConverter" />
    <converters:ZScoreToForegroundBrushConverter x:Key="ZScoreToForegroundBrushConverter" />
    <converters:ChartMeasurementToYAxisStartConverter x:Key="ChartMeasurementToYAxisStartConverter" />
    <converters:ChartMeasurementToYAxisEndConverter x:Key="ChartMeasurementToYAxisEndConverter" />
    <converters:ChartMeasurementToYAxisEndMultiConverter x:Key="ChartMeasurementToYAxisEndMultiConverter" />
    <converters:ChartYAxisStepConverter x:Key="ChartYAxisStepConverter" />
    <converters:CurveTypeToBooleanConverter x:Key="CurveTypeToBooleanConverter" />
    <converters:NullToCollapsedConverter x:Key="NullToCollapsedConverter" />
    <converters:DataCaptureModeToVisibilityConverter x:Key="DataCaptureModeToVisibilityConverter" />
    <converters:NullToDisabledConverter x:Key="NullToDisabledConverter" />
    <converters:BooleanToCollapsedConverter x:Key="BooleanToCollapsedConverter" />
    <converters:FlagBrushConverter x:Key="FlagBrushConverter" />
    <converters:FlagTextConverter x:Key="FlagTextConverter" />
    <converters:LengthToEnabledConverter x:Key="LengthToEnabledConverter" />

    <x:Array x:Key="MeasurementSystemsArray" Type="viewmodels:ComboBoxItemString">
        <viewmodels:ComboBoxItemString ValueString="Metric" DisplayString="Metric" />
        <viewmodels:ComboBoxItemString ValueString="Imperial" DisplayString="Imperial" />
    </x:Array>

    <x:Array x:Key="SexArray" Type="viewmodels:ComboBoxItemString">
        <viewmodels:ComboBoxItemString ValueString="M" DisplayString="Male" />
        <viewmodels:ComboBoxItemString ValueString="F" DisplayString="Female" />
    </x:Array>

    <x:Array x:Key="GrowthReferencesArray" Type="viewmodels:ComboBoxItemString">
        <viewmodels:ComboBoxItemString ValueString="WHO" DisplayString="WHO 2006/2007" />
        <viewmodels:ComboBoxItemString ValueString="CDC" DisplayString="CDC 2000" />
    </x:Array>

    <x:Array x:Key="IndicatorChartArray" Type="viewmodels:ComboBoxItemString">
        <viewmodels:ComboBoxItemString ValueString="BodyMassIndex" DisplayString="Body mass index-for-age" />
        <viewmodels:ComboBoxItemString ValueString="Weight" DisplayString="Weight-for-age" />
        <viewmodels:ComboBoxItemString ValueString="Height" DisplayString="Height-for-age" />
        <viewmodels:ComboBoxItemString ValueString="HeadCircumference" DisplayString="Head circumference-for-age" />
        <viewmodels:ComboBoxItemString ValueString="MidUpperArmCircumference" DisplayString="Mid-upper arm circumference-for-age" />
    </x:Array>

    <x:Array x:Key="CurveTypeArray" Type="viewmodels:ComboBoxItemString">
        <viewmodels:ComboBoxItemString ValueString="P" DisplayString="Percentiles" />
        <viewmodels:ComboBoxItemString ValueString="Z" DisplayString="Z-scores" />
    </x:Array>

    <x:Array x:Key="StandardsArray" Type="viewmodels:ComboBoxItemString">
        <viewmodels:ComboBoxItemString ValueString="WHO2006" DisplayString="WHO Child Growth Standards (0-5 years)" />
        <viewmodels:ComboBoxItemString ValueString="WHO2007" DisplayString="WHO Reference (5-19 years)" />
        <viewmodels:ComboBoxItemString ValueString="WHO20062007" DisplayString="Combined WHO Child Growth Standards and WHO Reference (0-19 years)" />
    </x:Array>

    <Color R="100" G="149" B="237" x:Key="ChildHeaderHighlightColor" />
    <Color R="245" G="246" B="248" x:Key="ChildBackgroundHighlightColor" />

    <!--<SolidColorBrush x:Key="AccentBrush" Color="#EF3444" />--> <!-- for red -->

    <SolidColorBrush x:Key="AccentVeryLightBrush" Color="#3780C8" />
    <SolidColorBrush x:Key="AccentLightBrush" Color="#2E6AA7" />
    <SolidColorBrush x:Key="AccentBrush" Color="#224F7B" />
    <SolidColorBrush x:Key="AccentDarkBrush" Color="#1B3F62" />

    <SolidColorBrush x:Key="ChildHeaderHighlightBrush" Color="#6495ED" />

    <SolidColorBrush x:Key="AccentTextHeaderBrush" Color="#224F7B" />

    
    
    <DataTemplate x:Key="IndicatorChartControlItemTemplate">
        <Ellipse x:Name="PART_Ellipse" Fill="Blue" Stroke="LightSkyBlue" StrokeThickness="1" Width="8" Height="8" ToolTipService.InitialShowDelay="0">
            <Ellipse.ToolTip>
                <!--<Border BorderThickness="1" BorderBrush="{StaticResource AccentDarkBrush}" SnapsToDevicePixels="True">-->
                <StackPanel>
                    <Label FontWeight="Bold" Content="{Binding AgeMonths, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} months'}" />
                    <Label FontWeight="Normal" Content="{Binding AgeYears, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} years'}" />
                    <Label FontWeight="Normal" Content="{Binding BodyMassIndex, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} BMI'}" />
                </StackPanel>
                <!--</Border>-->
            </Ellipse.ToolTip>
        </Ellipse>

        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding IsEditing}" Value="true">
                <Setter TargetName="PART_Ellipse" Property="Fill" Value="Red" />
                <Setter TargetName="PART_Ellipse" Property="Stroke" Value="Orange" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
    
    
    <DataTemplate x:Key="MeasurementItemTemplate">
        <Grid x:Name="PART_Grid" Background="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListViewItem}, Converter={StaticResource ChildSelectedBackgroundConverter}, ConverterParameter={StaticResource ChildBackgroundHighlightColor}}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <DockPanel Grid.Column="0" Width="8" Background="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListViewItem}, Converter={StaticResource ChildSelectedBackgroundConverter}, ConverterParameter={StaticResource ChildHeaderHighlightColor}}" />

            <Grid Grid.Column="2" Margin="10, 5, 0, 5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120" />
                    <ColumnDefinition Width="110" />
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="90" />
                    <ColumnDefinition Width="70" />
                    <ColumnDefinition Width="70" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Column="0" Foreground="#333333" FontSize="18" VerticalAlignment="Center" TextAlignment="Right" Margin="5, 2, 12, 2" Text="{Binding DateMeasurement, StringFormat=d}" />
                <TextBlock Grid.Column="1" FontSize="14" Margin="5, 2, 12, 2" VerticalAlignment="Center" Text="{Binding AgeMonths, StringFormat=0.0, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} months'}" />
                <TextBlock Grid.Column="2" FontSize="14" Margin="5, 2, 12, 2" VerticalAlignment="Center" Text="{Binding AgeYears, StringFormat=0.0, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} years'}" />
                <TextBlock Grid.Column="3" FontSize="14" Margin="5, 2, 12, 2" VerticalAlignment="Center" Text="{Binding Height, StringFormat=0.0, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} cm'}" />
                <TextBlock Grid.Column="4" FontSize="14" Margin="5, 2, 12, 2" VerticalAlignment="Center" Text="{Binding Weight, StringFormat=0.0, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} kg'}" />
                <TextBlock Grid.Column="5" FontSize="14" Margin="5, 2, 5, 2" VerticalAlignment="Center" Text="{Binding BodyMassIndex, StringFormat=0.0, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} BMI'}" />
                <!--<TextBlock Grid.Column="5" FontSize="14" Margin="5, 2, 5, 2" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding CDCBMIP, StringFormat=0.00, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} '}" />
                <TextBlock Grid.Column="6" FontSize="12" Margin="5, 2, 12, 2" VerticalAlignment="Center" TextAlignment="Left" Text="percentile (BMI)" />-->

            </Grid>

            <StackPanel Grid.Row="0" Grid.Column="0" x:Name="PART_UpperBorder" Grid.ColumnSpan="3" Background="#CCCCCC" Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0, 0, 0, 0" />
            <StackPanel Grid.Row="0" Grid.Column="0" x:Name="PART_LowerBorder" Grid.ColumnSpan="3" Background="#CCCCCC" Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="0, 0, 0, -1" />
        </Grid>

        <DataTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="PART_Grid" Property="Background" Value="#F5F7FC" />
            </Trigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate x:Key="NewProjectItemTemplate">

        <Border x:Name="PART_Border" BorderBrush="Silver" BorderThickness="3" Padding="10">
            <Grid x:Name="PART_Grid" Height="320" Width="240" Background="Transparent">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                
                <StackPanel Grid.Row="0">
                    <TextBlock Foreground="#444444" FontWeight="Light" Text="{Binding Title}" TextWrapping="Wrap" FontSize="24" />
                    <StackPanel Height="10" />
                    <TextBlock Foreground="#444444" FontWeight="Normal" FontSize="14" TextWrapping="Wrap" Text="{Binding Description}"  />
                </StackPanel>

                <Path Visibility="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListViewItem}, Converter={StaticResource BooleanToVisibilityConverter}}" 
                      Grid.Row="1" Width="37.9998" Height="31.6665" Stretch="Fill" Fill="CornflowerBlue" Data="F1 M 23.7501,33.25L 34.8334,44.3333L 52.2499,22.1668L 56.9999,26.9168L 34.8334,53.8333L 19.0001,38L 23.7501,33.25 Z "/>

            </Grid>
        </Border>

        <DataTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="PART_Border" Property="Background" Value="#F5F7FC" />
            </Trigger>

            <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListViewItem}}" Value="True">
                <Setter TargetName="PART_Border" Property="Background" Value="#F5F7FC" />
                <Setter TargetName="PART_Border" Property="BorderBrush" Value="CornflowerBlue" />
            </DataTrigger>
        </DataTemplate.Triggers>
        
    </DataTemplate>

    <DataTemplate x:Key="ChildItemTemplate">
        <Grid x:Name="PART_Grid" Background="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListViewItem}, Converter={StaticResource ChildSelectedBackgroundConverter}, ConverterParameter={StaticResource ChildBackgroundHighlightColor}}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <DockPanel Grid.Column="0" Width="8" Background="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListViewItem}, Converter={StaticResource ChildSelectedBackgroundConverter}, ConverterParameter={StaticResource ChildHeaderHighlightColor}}" />

            <Grid Grid.Column="1" Margin="10, 0, 0, 0">
                <Grid.ToolTip>
                    <TextBlock Text="Normal BMI" />
                </Grid.ToolTip>
                <Rectangle Margin="0, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="24" Height="24" Fill="{Binding LastMeasurement.WHOBMIZ, Converter={StaticResource FlagBrushConverter}, FallbackValue=SlateGray}" />
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="12" Foreground="White" FontWeight="Light" Text="{Binding LastMeasurement.WHOBMIZ, Converter={StaticResource FlagTextConverter}, FallbackValue=N}" />
            </Grid>

            <StackPanel Grid.Column="2" Margin="10, 5, 0, 5">
                <TextBlock Foreground="#333333" FontSize="18" TextWrapping="Wrap" Margin="5, 2, 5, 0">
                    <Run Text="{Binding NumericId, Mode=OneWay}" FontSize="14" />
                    <Run Text=" " />
                    <Run Text="{Binding FullName, Mode=OneWay}" />
                </TextBlock>
                <!--<TextBlock Foreground="#333333" FontSize="18" TextWrapping="Wrap" Margin="5, 2, 5, 0" Text="{Binding FullName}" />-->
                <!--<TextBlock Foreground="#555555" FontSize="14" Margin="5, 0, 5, 2" Text="{Binding LastMeasurement.AgeMonths, StringFormat=0.0, Converter={StaticResource MonthsStringFormatter}, ConverterParameter=' {0} months'}" />-->
            </StackPanel>

            <StackPanel x:Name="PART_LowerBorder" Grid.ColumnSpan="3" Background="#CCCCCC" Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
        </Grid>

        <DataTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="PART_Grid" Property="Background" Value="#F5F7FC" />
            </Trigger>
        </DataTemplate.Triggers>

    </DataTemplate>
    
    <Style x:Key="DataInputTextBoxStyle" TargetType="TextBox">
        <Setter Property="FontSize" Value="13" />
        <Setter Property="Width" Value="50" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Right" />
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Border BorderThickness="1" BorderBrush="#FFdc000c" VerticalAlignment="Top">
                            <Grid>
                                <AdornedElementPlaceholder x:Name="adorner" Margin="-1"/>
                            </Grid>
                        </Border>
                        <Border x:Name="errorBorder" Background="#FFdc000c" Margin="8,0,0,0"
                                Opacity="1" CornerRadius="0"
                                IsHitTestVisible="False"
                                MaxWidth="200"
                                MinHeight="24" >
                            <TextBlock Text="{Binding ElementName=adorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"
                                       Foreground="White" Margin="8,2,8,3" TextWrapping="Wrap" VerticalAlignment="Center"/>
                        </Border>
                    </StackPanel>
                    <!--<ControlTemplate.Triggers>
                            <DataTrigger Value="True">
                                <DataTrigger.Binding>
                                    <Binding ElementName="adorner" Path="AdornedElement.IsKeyboardFocused" />
                                </DataTrigger.Binding>
                                <DataTrigger.EnterActions>
                                    <BeginStoryboard x:Name="fadeInStoryboard">
                                        <Storyboard>
                                            <DoubleAnimation Duration="00:00:00.15"
                                                         Storyboard.TargetName="errorBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </DataTrigger.EnterActions>
                                <DataTrigger.ExitActions>
                                    <StopStoryboard BeginStoryboardName="fadeInStoryboard"/>
                                    <BeginStoryboard x:Name="fadeOutStoryBoard">
                                        <Storyboard>
                                            <DoubleAnimation Duration="00:00:00"
                                                         Storyboard.TargetName="errorBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </DataTrigger.ExitActions>
                            </DataTrigger>
                        </ControlTemplate.Triggers>-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DataDisplayTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource DataInputTextBoxStyle}">
        <Setter Property="FontFamily" Value="Consolas, 'Lucida Console', Monospace" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="Width" Value="60" />
        <Setter Property="Background" Value="{x:Static SystemColors.ControlBrush}" />
        <Setter Property="Foreground" Value="{x:Static SystemColors.GrayTextBrush}" />
        <Setter Property="IsReadOnly" Value="True" />
        <Setter Property="IsTabStop" Value="False" />
    </Style>

    <Style x:Key="DataDisplayTextBlockStyle" TargetType="TextBlock" >
        <Setter Property="FontSize" Value="14" />
    </Style>

    <Style x:Key="DemographicsTextBlockStyle" TargetType="TextBlock" >
        <Setter Property="FontSize" Value="14" />
        <Setter Property="Margin" Value="0, 4, 0, 4" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>

    <Style x:Key="ChildItemStyle" TargetType="{x:Type ListViewItem}">
        <Setter Property="Margin" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Height" Value="Auto" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Width" Value="Auto" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
    </Style>

    <Style x:Key="NewProjectItemStyle" TargetType="{x:Type ListViewItem}">
        <Setter Property="Margin" Value="0, 0, 10, 0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Height" Value="Auto" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Width" Value="Auto" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
    </Style>

    <Style x:Key="NewProjectListViewStyle" TargetType="{x:Type ListView}">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="ItemTemplate" Value="{StaticResource NewProjectItemTemplate}" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource NewProjectItemStyle}" />
        <Setter Property="IsSynchronizedWithCurrentItem" Value="True" />
    </Style>

    <Style x:Key="ChildListViewStyle" TargetType="{x:Type ListView}">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Margin" Value="-1" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="ItemTemplate" Value="{StaticResource ChildItemTemplate}" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource ChildItemStyle}" />
        <Setter Property="IsSynchronizedWithCurrentItem" Value="True" />
    </Style>

    <Style x:Key="MeasurementListViewStyle" TargetType="{x:Type ListView}">
        <Setter Property="BorderThickness" Value="0, 0, 0, 0" />
        <Setter Property="BorderBrush" Value="#CCCCCC" />
        <Setter Property="Margin" Value="-1" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="ItemTemplate" Value="{StaticResource MeasurementItemTemplate}" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource ChildItemStyle}" />
        <Setter Property="IsSynchronizedWithCurrentItem" Value="True" />
    </Style>
    
    <Style TargetType="Button" x:Key="BlankButtonStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Background="Transparent">
                        <ContentPresenter />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Button" x:Key="DarkButtonStyle">
        <Setter Property="Padding" Value="6, 3, 6, 3" />
        <Setter Property="Background" Value="{StaticResource AccentBrush}" />
        <Setter Property="TextBlock.Foreground" Value="White" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="PART_Border"
                        Background="{TemplateBinding Background}" 
                        Padding="{TemplateBinding Padding}" 
                        Width="{TemplateBinding Width}" 
                         >
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Border>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_Border" Property="Background" Value="{StaticResource AccentVeryLightBrush}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="PART_Border" Property="Background" Value="White" />
                            <Setter TargetName="PART_Border" Property="TextBlock.Foreground" Value="Black" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="PART_Border" Property="Background" Value="#6A7A95" />
                            <Setter TargetName="PART_Border" Property="TextBlock.Foreground" Value="#CCCCCC" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type controls:IndicatorChartControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:IndicatorChartControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            
                            <Canvas x:Name="canvasMain" Grid.Row="0" Grid.Column="2" Background="Transparent" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" />

                            <Canvas x:Name="canvasXAxis" Grid.Row="1" Grid.Column="2" Background="Transparent" Width="{TemplateBinding Width}" Height="24" />
                            
                            <StackPanel Grid.Row="2" Grid.Column="2" HorizontalAlignment="Center">
                                <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:IndicatorChartControl}, Mode=FindAncestor}, Path=XAxisLabel}" FontSize="11" FontWeight="Bold" HorizontalAlignment="Center" />
                            </StackPanel>

                            <TextBlock Grid.Row="0" Grid.Column="0"  Margin="0, 0, 10, 0"  Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:IndicatorChartControl}, Mode=FindAncestor}, Path=YAxisLabel}" FontSize="11" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" >
                                <TextBlock.LayoutTransform>
                                    <RotateTransform Angle="270" />
                                </TextBlock.LayoutTransform>
                            </TextBlock>

                            <Canvas x:Name="canvasYAxis" Grid.Row="0" Grid.Column="1" Width="20" Background="Transparent" />

                            <ItemsPresenter Grid.Row="0" Grid.Column="2" />
                        </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ContentPresenter}">
                    <Setter Property="Width" Value="Auto" />
                    <Setter Property="Height" Value="Auto" />
                    <Setter Property="Visibility">
                        <Setter.Value>
                            <Binding Path="BodyMassIndex" Converter="{StaticResource NullToVisibilityConverter}" />
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Margin" Value="-4,0,0,-4" />
                    <Setter Property="Canvas.Left">
                        <Setter.Value>
                            <MultiBinding Converter="{StaticResource ChartConverter}">
                                <!--<Binding Path="AgeYears" />-->
                                <Binding />
                                <Binding RelativeSource="{RelativeSource AncestorType={x:Type controls:IndicatorChartControl}, Mode=FindAncestor}" Path="XAxisPath" />
                                <Binding RelativeSource="{RelativeSource AncestorType={x:Type Canvas}, Mode=FindAncestor}" Path="ActualWidth" FallbackValue="0" />
                                <Binding RelativeSource="{RelativeSource AncestorType={x:Type controls:IndicatorChartControl}, Mode=FindAncestor}" Path="XAxisStartValue" FallbackValue="0" />
                                <Binding RelativeSource="{RelativeSource AncestorType={x:Type controls:IndicatorChartControl}, Mode=FindAncestor}" Path="XAxisEndValue" FallbackValue="0" />
                            </MultiBinding>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Canvas.Bottom">
                        <Setter.Value>
                            <MultiBinding Converter="{StaticResource ChartConverter}">
                                <!--<Binding Path="BodyMassIndex" />-->
                                <Binding />
                                <Binding RelativeSource="{RelativeSource AncestorType={x:Type controls:IndicatorChartControl}, Mode=FindAncestor}" Path="YAxisPath" />
                                <Binding RelativeSource="{RelativeSource AncestorType={x:Type Canvas}, Mode=FindAncestor}" Path="ActualHeight" FallbackValue="0" />
                                <Binding RelativeSource="{RelativeSource AncestorType={x:Type controls:IndicatorChartControl}, Mode=FindAncestor}" Path="YAxisStartValue" FallbackValue="0" />
                                <Binding RelativeSource="{RelativeSource AncestorType={x:Type controls:IndicatorChartControl}, Mode=FindAncestor}" Path="YAxisEndValue" FallbackValue="0" />
                            </MultiBinding>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas Background="Transparent" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="ItemTemplate" Value="{StaticResource IndicatorChartControlItemTemplate}" />
    </Style>

    <Style TargetType="{x:Type controls:IndicatorOutputsCDC}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:IndicatorOutputsCDC}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            TextBlock.FontSize="{TemplateBinding TextBlock.FontSize}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <!--<Grid Grid.Row="1" Grid.Column="2" Margin="0, 0, 0, 0" DataContext="{Binding MeasurementsView.CurrentItem}">-->
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="1" Margin="4" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Percentile" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="2" Margin="4" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Z-score" />

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="1" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Height for age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="2" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Weight for age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="3" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Weight for height" />

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="4" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="BMI for age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="5" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Head circumference" />


                            <TextBox Grid.Row="1" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCHAP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined'}" />
                            <TextBox Grid.Row="2" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCWAP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined'}" />
                            <TextBox Grid.Row="3" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCWHP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined'}" />
                            <TextBox Grid.Row="4" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCBMIP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined'}" />
                            <TextBox Grid.Row="5" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCHCP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined'}" />


                            <TextBox Grid.Row="1" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCHAZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined'}" />
                            <TextBox Grid.Row="2" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCWAZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined'}" />
                            <TextBox Grid.Row="3" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCWHZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined'}" />
                            <TextBox Grid.Row="4" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCBMIZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined'}" />
                            <TextBox Grid.Row="5" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding CDCHCZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined'}" />
                        </Grid>
                    
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type controls:MeasurementInputs}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:MeasurementInputs}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />

                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Measurement date" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="1" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="2" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Height" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="3" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Weight" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="4" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="BMI" />

                            <TextBlock x:Name="tblockHeadCircumference" Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="5" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Head circumference">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="CDC">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="5" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Head circumference">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            
                            <TextBlock 
                                Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="6" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Mid-upper arm circumference">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            
                            <TextBlock 
                                Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="7" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Subscapular skin fold">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            
                            <TextBlock 
                                Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="8" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Triceps skin fold">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>


                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" 
                                       Grid.Row="9" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Recumbent" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="10" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Oedema" />

                            <TextBlock Grid.Row="1" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="mos" />
                            <TextBlock Grid.Row="2" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="cm" />
                            <TextBlock Grid.Row="3" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="kg" />
                            <TextBlock Grid.Row="4" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="" />

                            <TextBlock Grid.Row="5" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="cm">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="CDC">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            
                            <TextBlock Grid.Row="5" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="cm">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            <TextBlock 
                                Grid.Row="6" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="cm">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            <TextBlock 
                                Grid.Row="7" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="mm">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            <TextBlock 
                                Grid.Row="8" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="mm">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>


                            <TextBlock Grid.Row="1" Grid.Column="1" Margin="4, 4, 0, 4" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{Binding AgeDays, Converter={StaticResource DaysToMonthsConverter}, StringFormat=0, FallbackValue='n/a'}" />

                            <controls:NumericTextBox 
                                Grid.Row="1" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right"
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Visibility="{Binding RelativeSource={RelativeSource AncestorType=controls:MeasurementInputs, Mode=FindAncestor}, Path=AllowsDirectAgeInput, Converter={StaticResource BooleanToVisibilityConverter}}"
                                Text="{Binding AgeDays, StringFormat=0.0, Converter={StaticResource DaysToMonthsConverter}, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue='', FallbackValue=''}">
                            </controls:NumericTextBox>


                            <TextBlock Grid.Row="4" Grid.Column="1" Margin="4, 4, 0, 4" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{Binding BodyMassIndex, StringFormat=0.0, FallbackValue='n/a'}" />
                            
                            <DatePicker Grid.Row="0" 
                                        Grid.Column="1" 
                                        Grid.ColumnSpan="2" 
                                        Margin="4, 4, 0, 4" 
                                        SelectedDate="{Binding DateMeasurement, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            
                            <controls:NumericTextBox 
                                Grid.Row="2" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right"
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding Height, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue='', FallbackValue='n/a'}">
                            </controls:NumericTextBox>

                            <controls:NumericTextBox 
                                Grid.Row="3" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right" 
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding Weight, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue='', FallbackValue='n/a'}" />

                            <controls:NumericTextBox 
                                Grid.Row="5" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right"
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding HeadCircumference, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a'}" >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="CDC">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <controls:NumericTextBox 
                                Grid.Row="5" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right"
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding HeadCircumference, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a'}" >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <controls:NumericTextBox
                                Grid.Row="6" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right" 
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding MidUpperArmCircumference, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a'}" >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <controls:NumericTextBox
                                Grid.Row="7" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right" 
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding SubscapularSkinfold, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a'}" >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <controls:NumericTextBox
                                Grid.Row="8" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right" 
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding TricepsSkinfold, Mode=TwoWay, UpdateSourceTrigger=LostFocus,ValidatesOnNotifyDataErrors=True,  TargetNullValue='', FallbackValue='n/a'}"
                                >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <CheckBox Grid.Row="9" Grid.Column="1"
                                      HorizontalAlignment="Right"
                                      VerticalAlignment="Center"
                                      IsChecked="{Binding IsRecumbent, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />
                            <CheckBox Grid.Row="10" Grid.Column="1" 
                                      HorizontalAlignment="Right"
                                      VerticalAlignment="Center"
                                      IsChecked="{Binding HasOedema, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />

                            <Rectangle Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="CDC">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle 
                                Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle 
                                Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle 
                                Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                        </Grid>
                        
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type controls:MeasurementInputs}" x:Key="ImperialMeasurementInputsStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:MeasurementInputs}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Measurement date" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="1" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="2" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Height" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="3" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Weight" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="4" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="BMI" />

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="5" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Head circumference">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="CDC">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="5" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Head circumference">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>

                            <TextBlock 
                                Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="6" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Mid-upper arm circumference">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>

                            <TextBlock 
                                Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="7" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Subscapular skin fold">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>

                            <TextBlock 
                                Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="8" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Triceps skin fold">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>

                            <TextBlock Grid.Row="1" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="mos" />
                            <TextBlock Grid.Row="2" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="in" />
                            <TextBlock Grid.Row="3" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="lbs" />
                            <TextBlock Grid.Row="4" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="" />

                            <TextBlock Grid.Row="5" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="in">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="CDC">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>

                            <TextBlock Grid.Row="5" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="in">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            <TextBlock 
                                Grid.Row="6" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="in">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            <TextBlock 
                                Grid.Row="7" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="mm">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>
                            <TextBlock 
                                Grid.Row="8" Grid.Column="2" Margin="4, 4, 0, 4" VerticalAlignment="Center" FontSize="12" Text="mm">
                                <TextBlock.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBlock.Visibility>
                            </TextBlock>


                            <TextBlock Grid.Row="1" Grid.Column="1" Margin="4, 4, 0, 4" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{Binding AgeDays, Converter={StaticResource DaysToMonthsConverter}, StringFormat=0, FallbackValue='n/a'}" />
                            <TextBlock Grid.Row="4" Grid.Column="1" Margin="4, 4, 0, 4" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{Binding BodyMassIndex, StringFormat=0.0, FallbackValue='n/a'}" />
                            <DatePicker Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Margin="4, 4, 0, 4" SelectedDate="{Binding DateMeasurement, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <controls:NumericTextBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Margin="4, 4, 0, 4" Style="{StaticResource DataInputTextBoxStyle}" Text="{Binding Height, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a', Converter={StaticResource InchesToCentimetersConverter}}" />
                            <controls:NumericTextBox Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" Margin="4, 4, 0, 4" Style="{StaticResource DataInputTextBoxStyle}" Text="{Binding Weight, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a', Converter={StaticResource PoundsToKilogramsConverter}}" />
                            <controls:NumericTextBox 
                                Grid.Row="5" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right"
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding HeadCircumference, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a', Converter={StaticResource InchesToCentimetersConverter}}" >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="CDC">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <controls:NumericTextBox 
                                Grid.Row="5" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right"
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding HeadCircumference, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a', Converter={StaticResource InchesToCentimetersConverter}}" >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <controls:NumericTextBox
                                Grid.Row="6" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right" 
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding MidUpperArmCircumference, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a', Converter={StaticResource InchesToCentimetersConverter}}" >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <controls:NumericTextBox
                                Grid.Row="7" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right" 
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding SubscapularSkinfold, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a'}" >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <controls:NumericTextBox
                                Grid.Row="8" 
                                Grid.Column="1" 
                                HorizontalAlignment="Right" 
                                Margin="4, 4, 0, 4" 
                                Style="{StaticResource DataInputTextBoxStyle}" 
                                Text="{Binding TricepsSkinfold, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnNotifyDataErrors=True, TargetNullValue='', FallbackValue='n/a'}"
                                >
                                <TextBox.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </TextBox.Visibility>
                            </controls:NumericTextBox>

                            <Rectangle Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray" />
                            <Rectangle Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="CDC">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle 
                                Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle 
                                Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>

                            <Rectangle 
                                Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Fill="LightGray">
                                <Rectangle.Visibility>
                                    <MultiBinding Converter="{StaticResource AgeAndReferenceToVisibilityConverter}" ConverterParameter="WHO">
                                        <Binding Path="AgeMonths" />
                                        <Binding Source="{x:Static p:Settings.Default}" Path="PrimaryGrowthReference" FallbackValue="WHO" />
                                    </MultiBinding>
                                </Rectangle.Visibility>
                            </Rectangle>
                        </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type controls:IndicatorOutputsWHO}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:IndicatorOutputsWHO}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            TextBlock.FontSize="{TemplateBinding TextBlock.FontSize}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="1" Margin="4" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Percentile" />
                                <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="2" Margin="4" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Z-score" />

                                <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="1" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Height for age" />
                                <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="2" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Weight for age" />
                                <TextBlock Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="3" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Weight for height" />

                                <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="4" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="BMI for age" />
                                <TextBlock Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="5" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Head circumference" />

                                <TextBlock Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="6" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="MUAC for age" />
                                <TextBlock Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="7" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="SSF for age" />
                                <TextBlock Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="8" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="TSF for age" />


                                <TextBox Grid.Row="1" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOHAP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="2" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOWAP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Row="3" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOWHP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="4" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOBMIP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined'}" />
                                <TextBox Grid.Row="5" Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOHCP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />

                                <TextBox Grid.Row="6" Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOMUACP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="7" Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOSSFP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="8" Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOTSFP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />


                                <TextBox Grid.Row="1" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOHAZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOHAZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOHAZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="2" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOWAZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOWAZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOWAZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Row="3" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOWHZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOWHZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}"  Text="{Binding WHOWHZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="4" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOBMIZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOBMIZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOBMIZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="5" Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOHCZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOHCZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOHCZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />

                                <TextBox Grid.Row="6" Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOMUACZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOMUACZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOMUACZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="7" Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOSSFZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOSSFZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOSSFZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                                <TextBox Grid.Row="8" Visibility="{Binding AgeMonths, Converter={StaticResource WHOAgeCutoffToVisibilityConverter}}" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOTSFZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOTSFZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOTSFZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type controls:IndicatorOutputsWHO}" x:Key="HorizontalWHOIndicatorsStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:IndicatorOutputsWHO}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            TextBlock.FontSize="{TemplateBinding TextBlock.FontSize}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />

                                <ColumnDefinition Width="50" />

                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="1" Margin="4" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Percentile" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="2" Margin="4" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Z-score" />

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="5" Margin="4" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Percentile" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="0" Grid.Column="6" Margin="4" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Z-score" />

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="1" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Height for age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="2" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Weight for age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="3" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" Text="Weight for height" />

                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="4" Grid.Column="0" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="BMI for age" />
                            
                            
                            
                            
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="1" Grid.Column="4" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="Head circumference" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="2" Grid.Column="4" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="MUAC for age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="3" Grid.Column="4" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="SSF for age" />
                            <TextBlock Style="{StaticResource DataDisplayTextBlockStyle}" Grid.Row="4" Grid.Column="4" Margin="0, 6, 8, 6" VerticalAlignment="Center" TextWrapping="Wrap" Text="TSF for age" />


                            <TextBox Grid.Row="1" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOHAP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="2" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOWAP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="3" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOWHP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="4" Grid.Column="1" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOBMIP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined'}" />
                            
                            <TextBox Grid.Row="1" Grid.Column="5" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOHCP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="2" Grid.Column="5" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOMUACP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="3" Grid.Column="5" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOSSFP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="4" Grid.Column="5" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Text="{Binding WHOTSFP, Mode=OneWay, StringFormat=0.00, FallbackValue='Undefined', TargetNullValue='n/a'}" />


                            <TextBox Grid.Row="1" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOHAZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOHAZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOHAZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="2" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOWAZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOWAZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOWAZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="3" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOWHZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOWHZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}"  Text="{Binding WHOWHZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="4" Grid.Column="2" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOBMIZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOBMIZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOBMIZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            
                            <TextBox Grid.Row="1" Grid.Column="6" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOHCZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOHCZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOHCZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="2" Grid.Column="6" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOMUACZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOMUACZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOMUACZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="3" Grid.Column="6" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOSSFZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOSSFZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOSSFZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                            <TextBox Grid.Row="4" Grid.Column="6" Margin="10, 4, 10, 4" Style="{StaticResource DataDisplayTextBoxStyle}" Background="{Binding WHOTSFZ, Converter={StaticResource ZScoreToBackgroundBrushConverter}}" Foreground="{Binding WHOTSFZ, Converter={StaticResource ZScoreToForegroundBrushConverter}}" Text="{Binding WHOTSFZ, Mode=OneWay, StringFormat=0.000, FallbackValue='Undefined', TargetNullValue='n/a'}" />
                        </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type controls:SettingsPanel}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:SettingsPanel}">
                    <Border Padding="16, 8, 16, 16"
                            Width="300"
                            Height="Auto"
                            Background="#F6F7FA"
                            BorderBrush="#CCCCCC"
                            BorderThickness="1">
                        <StackPanel>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" VerticalAlignment="Center" Margin="4" FontWeight="Light" FontSize="24" Text="Preferences" />
                                <!--<Path Grid.Column="1" Width="18" Height="18" HorizontalAlignment="Right" VerticalAlignment="Center" Stretch="Fill" Fill="Black" Data="F1 M 38,23.5C 38.8643,23.5 39.7109,23.5756 40.5337,23.7206L 42.6275,18.5381L 48.1901,20.787L 46.0964,25.9692C 47.6473,27.0149 48.9851,28.3527 50.0308,29.9036L 55.213,27.8099L 57.4619,33.3725L 52.2794,35.4664C 52.4244,36.2891 52.5,37.1357 52.5,38C 52.5,38.8643 52.4244,39.7109 52.2794,40.5337L 57.4619,42.6275L 55.213,48.1901L 50.0308,46.0964C 49.0795,47.5073 47.8865,48.7418 46.5112,49.7405L 48.7844,54.8462L 43.3041,57.2891L 41.0307,52.1828C 40.0533,52.3906 39.0394,52.5 38,52.5C 37.1357,52.5 36.2891,52.4244 35.4664,52.2794L 33.3725,57.462L 27.8099,55.213L 29.9036,50.0309C 28.3527,48.9851 27.0149,47.6473 25.9691,46.0964L 20.787,48.1901L 18.538,42.6275L 23.7206,40.5336C 23.5756,39.7109 23.5,38.8643 23.5,38C 23.5,37.1357 23.5756,36.2891 23.7206,35.4664L 18.538,33.3725L 20.787,27.8099L 25.9691,29.9036C 26.9205,28.4927 28.1135,27.2582 29.4889,26.2594L 27.2157,21.1537L 32.6959,18.7109L 34.9694,23.8172C 35.9468,23.6094 36.9606,23.5 38,23.5 Z M 38,28C 32.4771,28 28,32.4772 28,38C 28,43.5229 32.4771,48 38,48C 43.5228,48 48,43.5229 48,38C 48,32.4772 43.5228,28 38,28 Z "/>-->

                                <Button Grid.Column="1" Style="{StaticResource BlankButtonStyle}" 
                        Margin="0, -16, 4, 0"
                        Command="{Binding ToggleShowSettingsCommand}">
                                    <Path 
                        Fill="Black"
                        Stretch="Fill"
                        Height="28"
                        Width="28"
                        Data="F1 M 38,23.5C 38.8643,23.5 39.7109,23.5756 40.5337,23.7206L 42.6275,18.5381L 48.1901,20.787L 46.0964,25.9692C 47.6473,27.0149 48.9851,28.3527 50.0308,29.9036L 55.213,27.8099L 57.4619,33.3725L 52.2794,35.4664C 52.4244,36.2891 52.5,37.1357 52.5,38C 52.5,38.8643 52.4244,39.7109 52.2794,40.5337L 57.4619,42.6275L 55.213,48.1901L 50.0308,46.0964C 49.0795,47.5073 47.8865,48.7418 46.5112,49.7405L 48.7844,54.8462L 43.3041,57.2891L 41.0307,52.1828C 40.0533,52.3906 39.0394,52.5 38,52.5C 37.1357,52.5 36.2891,52.4244 35.4664,52.2794L 33.3725,57.462L 27.8099,55.213L 29.9036,50.0309C 28.3527,48.9851 27.0149,47.6473 25.9691,46.0964L 20.787,48.1901L 18.538,42.6275L 23.7206,40.5336C 23.5756,39.7109 23.5,38.8643 23.5,38C 23.5,37.1357 23.5756,36.2891 23.7206,35.4664L 18.538,33.3725L 20.787,27.8099L 25.9691,29.9036C 26.9205,28.4927 28.1135,27.2582 29.4889,26.2594L 27.2157,21.1537L 32.6959,18.7109L 34.9694,23.8172C 35.9468,23.6094 36.9606,23.5 38,23.5 Z M 38,28C 32.4771,28 28,32.4772 28,38C 28,43.5229 32.4771,48 38,48C 43.5228,48 48,43.5229 48,38C 48,32.4772 43.5228,28 38,28 Z "></Path>
                                </Button>
                            </Grid>
                            
                            <Label FontWeight="Bold" Content="Language:" />
                            <ComboBox SelectedIndex="0" IsEnabled="False">
                                <ComboBoxItem>English</ComboBoxItem>
                            </ComboBox>

                            <Label FontWeight="Bold" Content="Measurement system:" />
                            <ComboBox SelectedValue="{Binding Source={x:Static p:Settings.Default}, Path=MeasurementSystem, Mode=TwoWay}" 
                                      SelectedValuePath="ValueString"
                                      DisplayMemberPath="DisplayString"
                                      ItemsSource="{StaticResource MeasurementSystemsArray}" />

                            <!--<Label FontWeight="Bold" Content="Default growth reference:" />
                            <ComboBox SelectedValue="{Binding Source={x:Static p:Settings.Default}, Path=PrimaryGrowthReference, Mode=TwoWay}" 
                                      SelectedValuePath="ValueString"
                                      DisplayMemberPath="DisplayString"
                                      ItemsSource="{StaticResource GrowthReferencesArray}" />-->
                            
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type controls:MessageBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:MessageBox}">
                    <Border Background="{StaticResource AccentDarkBrush}" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Grid Width="500" Margin="20">
                            <Grid.Resources>
                                <Style TargetType="TextBlock">
                                    <Setter Property="TextWrapping" Value="Wrap" />
                                    <Setter Property="Foreground" Value="White" />
                                </Style>
                            </Grid.Resources>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <TextBlock Grid.Row="0" FontWeight="Light" FontSize="24" Margin="0,0,0,10" Text="{Binding Path=Title, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}" />

                            <ContentPresenter Grid.Row="1" Margin="0, 0, 0, 20" >
                                <ContentPresenter.Resources>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="TextWrapping" Value="Wrap" />
                                        <Setter Property="Foreground" Value="White" />
                                    </Style>
                                </ContentPresenter.Resources>
                            </ContentPresenter>
                            
                            <Grid Grid.Row="2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>

                                <!-- OKCancel -->
                                <Button Grid.Column="2" Style="{StaticResource DarkButtonStyle}" Margin="2, 0, 2, 0" Background="{StaticResource AccentLightBrush}" 
                                        Command="{Binding Path=AcceptCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}"
                                        Visibility="{Binding Path=MessageBoxButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}, Converter={StaticResource MessageBoxButtonConverter}, ConverterParameter='OKCancel'}">OK</Button>
                                <Button Grid.Column="3" Style="{StaticResource DarkButtonStyle}" Margin="2, 0, 0, 0" Background="{StaticResource AccentLightBrush}" 
                                        Command="{Binding Path=CancelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}"
                                        Visibility="{Binding Path=MessageBoxButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}, Converter={StaticResource MessageBoxButtonConverter}, ConverterParameter='OKCancel'}">Cancel</Button>

                                <!-- OK -->
                                <Button Grid.Column="3" Style="{StaticResource DarkButtonStyle}" Margin="2, 0, 2, 0" Background="{StaticResource AccentLightBrush}"  
                                        Command="{Binding Path=AcceptCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}"
                                        Visibility="{Binding Path=MessageBoxButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}, Converter={StaticResource MessageBoxButtonConverter}, ConverterParameter='OK'}">OK</Button>

                                <!-- YesNo -->
                                <Button Grid.Column="2" Style="{StaticResource DarkButtonStyle}" Margin="2, 0, 2, 0" Background="{StaticResource AccentLightBrush}" 
                                        Command="{Binding Path=AcceptCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}"
                                        Visibility="{Binding Path=MessageBoxButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}, Converter={StaticResource MessageBoxButtonConverter}, ConverterParameter='YesNo'}">Yes</Button>
                                <Button Grid.Column="3" Style="{StaticResource DarkButtonStyle}" Margin="2, 0, 0, 0" Background="{StaticResource AccentLightBrush}" 
                                        Command="{Binding Path=CancelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}"
                                        Visibility="{Binding Path=MessageBoxButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}, Converter={StaticResource MessageBoxButtonConverter}, ConverterParameter='YesNo'}">No</Button>

                                <!-- YesNoCancel -->
                                <Button Grid.Column="1" Style="{StaticResource DarkButtonStyle}" Margin="2, 0, 2, 0" Background="{StaticResource AccentLightBrush}"
                                        Command="{Binding Path=AcceptCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}"
                                        Visibility="{Binding Path=MessageBoxButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}, Converter={StaticResource MessageBoxButtonConverter}, ConverterParameter='YesNoCancel'}">Yes</Button>
                                <Button Grid.Column="2" Style="{StaticResource DarkButtonStyle}" Margin="2, 0, 2, 0" Background="{StaticResource AccentLightBrush}" 
                                        Command="{Binding Path=RejectCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}"
                                        Visibility="{Binding Path=MessageBoxButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}, Converter={StaticResource MessageBoxButtonConverter}, ConverterParameter='YesNoCancel'}">No</Button>
                                <Button Grid.Column="3" Style="{StaticResource DarkButtonStyle}" Margin="2, 0, 0, 0" Background="{StaticResource AccentLightBrush}" 
                                        Command="{Binding Path=CancelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}}"
                                        Visibility="{Binding Path=MessageBoxButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MessageBox}}, Converter={StaticResource MessageBoxButtonConverter}, ConverterParameter='YesNoCancel'}">Cancel</Button>
                            </Grid>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ProjectBorderStyle" TargetType="Border">
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="3" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <!--<Setter Property="Background" Value="{DynamicResource ButtonBackgroundHover}" />-->
                <!--#CDD1D2-->
                <!--<Setter Property="BorderBrush" Value="#CDD1D2" />-->
                <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />


            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ProjectGridStyle" TargetType="Grid">
        <!--<Setter Property="Background" Value="#F5F5F5" />-->
        <Setter Property="Background" Value="White" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <!--<Setter Property="Background" Value="{DynamicResource ButtonBackgroundHover}" />-->
                <!--#CDD1D2-->
            </Trigger>
        </Style.Triggers>
    </Style>

    <HierarchicalDataTemplate x:Key="ProjectSummaryViewItemTemplate">
        <Border Style="{StaticResource ProjectBorderStyle}" x:Name="PART_Border" IsHitTestVisible="True" HorizontalAlignment="Left">
            <Grid>
                <Grid x:Name="grdProject" Width="400" Height="110" Style="{StaticResource ProjectGridStyle}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="90" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <!--File scr data-->
                    <TextBlock Foreground="#333333" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="10, 10, 10, 0" x:Name="projectInfoTitleTextBlock" FontSize="17" FontWeight="SemiBold" Text="{Binding Name}"  IsHitTestVisible="False"/>
                    <!--<TextBlock Foreground="#333333" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="10, 10, 10, 0" x:Name="projectReg_CultureTextBlock" FontSize="13" FontWeight="SemiBold"    VerticalAlignment="Top"     Text="{Binding  Reg_culture  }"  IsHitTestVisible="False"/>-->
                    <TextBlock Foreground="{StaticResource AccentVeryLightBrush}" FontWeight="Bold"  Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="10, 0, 10, 0" x:Name="projectInfoDescTextBlock" FontSize="13" VerticalAlignment="Top" TextWrapping="Wrap" Text="{Binding Author}"  IsHitTestVisible="False"/>
                    <TextBlock Foreground="#626262" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="10, 0, 10, 10" x:Name="projectInfoDateTextBlock" FontSize="13" VerticalAlignment="Top" TextWrapping="Wrap" Text="{Binding Description}"  IsHitTestVisible="False"/>

                    <Border Grid.Column="1" HorizontalAlignment="Right" Margin="5" Background="LightGray" Padding="4, 2, 4, 2">
                        <TextBlock Foreground="White" Text="NS" HorizontalAlignment="Center" TextAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                    
                    <Border Grid.Column="1" HorizontalAlignment="Right" Margin="5" Background="LightGray" Padding="4, 2, 4, 2" Visibility="{Binding DataCaptureMode, Converter={StaticResource DataCaptureModeToVisibilityConverter}}">
                        <TextBlock Foreground="White" Text="IA" HorizontalAlignment="Center" TextAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                </Grid>
            </Grid>
        </Border>

        <DataTemplate.Triggers>
            <EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="PART_Border">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetName="PART_Border" Duration="00:00:00.125"
                                         Storyboard.TargetProperty="Opacity" From="0" To="1" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </DataTemplate.Triggers>

    </HierarchicalDataTemplate>

    <Style TargetType="{x:Type controls:ProjectsSummaryView}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate x:Name="x1" TargetType="{x:Type controls:ProjectsSummaryView}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ItemsPresenter DockPanel.Dock="Bottom" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Vertical" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ContentPresenter}">
                    <Setter Property="Height" Value="Auto"></Setter>
                    <Setter Property="Margin" Value="0,0,2,2"></Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate" Value="{StaticResource ProjectSummaryViewItemTemplate}" />
    </Style>

    <Style TargetType="{x:Type DataGrid}">
        <Setter Property="VerticalGridLinesBrush" Value="#D5D5D5" />
        <Setter Property="HorizontalGridLinesBrush" Value="#D5D5D5" />
        <Setter Property="Foreground" Value="#333335"/>
        <Setter Property="FontFamily" Value="Calibri"/>
        <Setter Property="AutoGenerateColumns" Value="False" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="EnableRowVirtualization" Value="True" />
        <Setter Property="EnableColumnVirtualization" Value="True" />
        <Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected" />
        <Setter Property="CanUserAddRows" Value="False" />
        <Setter Property="CanUserDeleteRows" Value="False" />
        <Setter Property="CanUserResizeColumns" Value="True" />
        <Setter Property="CanUserResizeRows" Value="False" />
        <Setter Property="CanUserSortColumns" Value="True" />
        <Setter Property="SelectionUnit" Value="FullRow" />
        <Setter Property="HeadersVisibility" Value="All" />
        <Setter Property="AreRowDetailsFrozen" Value="False" />
        <Setter Property="SelectionMode" Value="Single" />
    </Style>

    <Style TargetType="{x:Type DataGridRowHeader}">
        <Setter Property="Background" Value="White" />
    </Style>

    <Style TargetType="DataGridColumnHeader">
        <Setter Property="Background" Value="#DDDDDF" />
        <Setter Property="BorderThickness" Value="0,0,1,1" />
        <Setter Property="BorderBrush" Value="#D5D5D5" />
        <Setter Property="Padding" Value="4" />
        <Setter Property="FontSize" Value="12" />
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
    </Style>

    <Style TargetType="{x:Type DataGridCell}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="FontSize" Value="13" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border Background="{TemplateBinding Background}" 
                                Padding="2, 3, 2, 3"
                  BorderBrush="{TemplateBinding BorderBrush}"  
                  BorderThickness="{TemplateBinding BorderThickness}" 
                  SnapsToDevicePixels="True">
                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsSelected"
                        Value="True">
                <Setter Property="Background"
                        Value="{StaticResource AccentBrush}" />
                <Setter Property="BorderBrush"
                        Value="Transparent" />
                <Setter Property="Foreground"
                        Value="White" />
            </Trigger>
        </Style.Triggers>

    </Style>


    <Style TargetType="{x:Type controls:LoadingScreen}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:LoadingScreen}">
                    <Border Background="{StaticResource AccentDarkBrush}" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Grid Width="500" Margin="20">
                            <Grid.Resources>
                                <Style TargetType="TextBlock">
                                    <Setter Property="TextWrapping" Value="Wrap" />
                                    <Setter Property="Foreground" Value="White" />
                                </Style>
                            </Grid.Resources>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <TextBlock Grid.Row="0" FontWeight="Light" FontSize="24" Margin="0,0,0,10" Text="{Binding Path=Title, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:LoadingScreen}}}" />

                            <Border Grid.Row="1" BorderBrush="#EFEFEF" BorderThickness="1" Padding="2">
                                <ProgressBar Grid.Row="1" 
                                         Minimum="0" 
                                         Maximum="100" 
                                         Height="20"
                                         BorderBrush="Transparent"
                                         Foreground="#EFEFEF"
                                         HorizontalAlignment="Stretch" 
                                         IsIndeterminate="False"
                                         Background="Transparent" 
                                         Value="{Binding Path=Progress, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:LoadingScreen}}}" />
                            </Border>

                            <TextBlock Grid.Row="2" Margin="0, 10, 0, 10" Text="{Binding Path=Message, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:LoadingScreen}}}" />
                            
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
